Repository navigation
feat(dictation): add the documented llm request to DictationConfig - #320
Open
mayankbohradev wants to merge 1 commit into
Open
mayankbohradev wants to merge 1 commit into
mayankbohradev wants to merge 1 commit into
Conversation
DictationConfig rejects unknown fields and had no llm field, so the documented custom LLM request and the saved-prompt (aai_prompt) flow could not be sent from the SDK. Add DictationLLMRequest with the 13 fields the docs list, and DictationConfig.llm. The config is rejected before sending for the documented 400s: llm with llm_instruction, max_tokens or max_completion_tokens above 8192, other fields or rewrite_mode with aai_prompt, text or transcript in prompt_replacements, and prompt_replacements without aai_prompt. Model names are left to the server. Closes AssemblyAI#299
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
DictationConfig.llm, so the SDK can send the documented "Sending your own LLM request" rewrite: your ownmessages/promptwith{{turn}}, or a saved prompt byaai_prompt.Why
Closes #299.
DictationConfigrejects unknown fields, and it had nollmfield. SoDictationConfig(llm=...)raised, and the saved-prompt flow that the "Authenticate your app" page recommends for on-device apps could not be sent from the SDK.How
DictationLLMRequest: a new model with the 13 fields the docs list (model,messages,prompt,temperature,top_p,top_k,max_tokens,max_completion_tokens,response_format,reasoning_effort,aai_prompt,prompt_replacements,zero_data_retention). Unknown fields are rejected, as onDictationConfig. A plain dict works too.llmtogether withllm_instructionmax_tokensormax_completion_tokensabove 8192prompt_replacementsalongsideaai_promptrewrite_modewith a saved prompttextortranscriptinprompt_replacementsprompt_replacementswithoutaai_prompt{{turn}}goes out unchanged.Testing
test_dictation.pyandtest_dictation_async.py. They read theconfigpart that is actually sent. Each rule has a test, and each test failed before the change.tox -e py312-latest,py311-pydantic1.10: all pass, excepttest_tts.py::test_a_forked_child_does_not_share_the_parents_tts_connections, which fails the same way on master on my machine.ruff format --checkandruff checkare clean.mypy --follow-imports=silent --ignore-missing-importson the changed files: no new errors. It reports the tworead()override errors that are already on master.scripts/build_api_docs.sh+docs/check_api_docs.py: OK, andDictationLLMRequestis documented.Notes for reviewers
aai.DictationLLMRequest(also exported fromassemblyai.dictationandassemblyai.dictation.v1).llm_instructionon a config that hasllm) is not checked, the same as the existing length caps. The server's 400 then comes back asDictationError.llm={}is sent as{}, because the docs name no rule for it.DictationConfig; the two merge cleanly apart from the version line.